package 剑指offer.demo2;
//https://www.nowcoder.com/practice/72a5a919508a4251859fb2cfb987a0e6?

/**
 * 本质也是斐波那契数列
 */
public class 矩形覆盖 {
    public int rectCover(int target) {
        //特殊情况考虑
        if (target < 2)
            return target;
        //定义数组进行保存中间一些重复的计算量
        int[] arr = new int[target + 1];
        arr[1] = 1;
        arr[2] = 2;
        for (int i = 3; i < arr.length; i++) {
            arr[i] = arr[i - 1] + arr[i - 2];
        }
        return arr[target];
    }
}
